package game.players.user.movements;

import com.uqbar.vainilla.DeltaState;
import com.uqbar.vainilla.events.constants.Key;

import game.players.SoccerPlayer;

public class WithoutBallRightMovingUser extends WithoutBallAbstractMovingUser {

	public WithoutBallRightMovingUser(SoccerPlayer player, double x, double y) {
		super(player, x, y);
		this.getPlayer().setRightAnimationWithSpeed(0.1);
	}
	
	@Override
	public void update(DeltaState deltaState) {
		if(deltaState.isKeyBeingHold(Key.RIGHT) && deltaState.isKeyBeingHold(Key.UP))
			this.getPlayer().setState(new WithoutBallDiagonalRightUpMovingUser(this.getPlayer(), this.getPlayer().getMovementSpeed(), -this.getPlayer().getMovementSpeed()));
		else {
			if(deltaState.isKeyBeingHold(Key.RIGHT) && deltaState.isKeyBeingHold(Key.DOWN))
				this.getPlayer().setState(new WithoutBallDiagonalRightDownMovingUser(this.getPlayer(), this.getPlayer().getMovementSpeed(), this.getPlayer().getMovementSpeed()));
		}
		
		if (!deltaState.isKeyBeingHold(Key.RIGHT))
			this.getPlayer().setState(new WithoutBallStationaryUser(this.getPlayer()));
		
		super.update(deltaState);
	}

	@Override
	public boolean isRight() {
		return true;
	}

}
